/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package hw2;

/**
 * 2-Dimensional point (x,y)
 *
 * @author Avishay
 */
public class Point {

    private int x;
    private int y;

    public Point(int x, int y) {
        this.x = x;
        this.y = y;
    }
    
    public int getX() {
        return this.x;
    }
    
    public int getY() {
        return this.y;
    }
    
    public boolean inRectangle(Rectangle rect) {
        // Checks whether this Point is contained in the given rectangle.
        if (this.x >= rect.getStartPoint().getX() && this.x <= rect.getEndPoint().getX() &&
                this.y >= rect.getStartPoint().getY() && this.y <= rect.getEndPoint().getY()) {
            return true;
        }
        else {
            return false;
        }
    }
}
